package bavaria.hightech.banking.gui;

import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;

/**
 * This class itself is a JMenu bar. Specifies all menu entries of the menu
 * bottom-up.
 */
public class Menu extends JMenuBar {
	private static final long serialVersionUID = 8072723789643259826L;

	/**
	 * Constructor of the menu. Parameters are not needed here but are
	 * delegated.
	 * 
	 * @param frame
	 *            needed for the Quit command to destroy the frame
	 * @param cont
	 *            contains some references important for interaction
	 */
	public Menu(Frame frame, GlobalVarsContainer cont) {

		JMenu file = new JMenu("File");
		JMenu account = new JMenu("Account");
		JMenu money = new JMenu("Money");

		JMenuItem menuItem = new JMenuItem("View balance");
		menuItem.addActionListener(new ListenerViewBalance(cont));
		money.add(menuItem);

		menuItem = new JMenuItem("Bank transfer");
		menuItem.addActionListener(new ListenerTransfer(cont));
		money.add(menuItem);

		menuItem = new JMenuItem("Specify account");
		menuItem.addActionListener(new ListenerSpecifyAccount(cont));
		account.add(menuItem);

		menuItem = new JMenuItem("Quit");
		menuItem.addActionListener(new ListenerQuit(frame));
		file.add(menuItem);

		this.add(file);
		this.add(account);
		this.add(money);

	}
}
